package com.wb.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.RemoteTokenServices;
import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;

/**
 * 验证服务
 */
@Configuration
public class TokenConfig {

    private final Logger logger = LoggerFactory.getLogger(TokenConfig.class);

    @Bean(name = "tokenServices")
    public ResourceServerTokenServices tokenServices() {
        RemoteTokenServices remoteTokenServices = new RemoteTokenServices();
//        remoteTokenServices.setCheckTokenEndpointUrl("http://192.168.1.14:9401/oauth/check_token");
        remoteTokenServices.setCheckTokenEndpointUrl("http://192.168.1.6:9401/oauth/check_token");
        remoteTokenServices.setClientId("admin");
        remoteTokenServices.setClientSecret("admin123");
        return remoteTokenServices;
    }
}
